<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录-青鸟商城</title>
    <link rel="stylesheet" href="./assets/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="./assets/css/common.css">  
    <link rel="stylesheet" href="./assets/css/login.css?v=2020">
</head>

<body>

    <nav class="navbar navbar-static-top">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="./index.html">青鸟商城</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li class="active"><a href="#">热门推荐 <span class="sr-only">(current)</span></a></li>
                    <li><a href="#">国际品牌</a></li>
                    <li><a href="#">数码电器</a></li>
                    <li><a href="#">每日特价</a></li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="./login.html">登录</a></li>
                    <li><a href="./reg.html">注册</a></li>
                </ul>
            </div>
        </div>
    </nav>
    <!-- 注册区域 -->
    <div class="reg">
        <div class="container">
            <div class="row">
                <div class="col-lg-8">
                </div>
                <div class="col-lg-4">
                    
                    <form class="reg-form" method="POST" action="./ucenter.html">
                        <div class="form-group">
                            <label for="username">登录账号</label>
                            <input type="text" class="form-control input-lg" id="username" placeholder="登录账号">
                        </div>
                        <div class="form-group">
                            <label for="password">登录密码</label>
                            <input type="password" class="form-control input-lg" id="password" placeholder="登录密码">
                        </div>
                        <button id="btn-login" type="button" class="btn btn-danger btn-lg btn-block">立即登录</button>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <div class="container-fluid footer">
        <div class="row">
            <div class="col-lg-12">
                Copyright 2019 by www.braccp.com 北京畅想唯优信息技术有限公司 All rights reserved.
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                联系电话：029-88212666 地址：西安市雁塔区电子一路 石油大学北门工会楼二层
            </div>
        </div>

        <div class="row">
            <div class="col-lg-12">
                备案号：陕ICP备19013769号-1
            </div>
        </div>
    </div>
</body>
<script src="./assets/js/jquery.js"></script>
<script src="./assets/layer/layer.js"></script>
<script src="./assets/js/common.js"></script>
<script>
$(function(){
    $("#btn-login").on('click',function(){
        var username=$("#username").val().trim();
        var password=$("#password").val().trim();
        $.post('/apis/index.php?c=user&a=login',{username,password},function(res){
            console.log(res);
            if(res.errcode==0){
                localStorage.setItem('token',res.token);
                location.href='./ucenter.html';
            }else{
                layer.msg('用户名或账号错误');
            }
        },'json');
    });
});
</script>
</html>